package reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class ReflectDemo02 {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        Class<Person> personClass = Person.class;
        Constructor<Person> constructor = personClass.getConstructor(String.class, int.class);
        Person person = constructor.newInstance("xiaoming", 12);
        System.out.println(person);
        dosome("1");
        dosome("1","2");
        dosome("1","2","3");
    }

    public static void dosome(String... args) {
        // jdk1.5特性 变长参数
        System.out.println(1);
    }
}
